import 'core-js/es6/promise';
import axios from 'axios';
import Vue from 'vue';
import {mytips} from '@/module/tools';
import '../../../static/css/common.css';
Vue.config.productionTip = false;


axios.interceptors.response.use(
    res => {
        window.mytips = mytips
        if (res.data.code > 0) {
            console.log("返回的响应code>0")

            mytips(res.data.message);
        } else if (res.data.code < 0) {
            console.log("返回的响应code<0")
            mytips('系统异常')
        }
        return res;
    },
    error => {
        mytips('连接异常');
        return Promise.reject(error);
    }
);
new Vue({
    el: '#app',
    data: function () {
        return {
            citise: [],
            userList: [],
            username: "",
            password: 'judian3321',
            msg: 'hello.vue'
        }
    },
    methods: {
        register: function () {
            axios({
                method: 'post',
                url: API_PATH + '/register',
                dataType: 'json',
                params: {
                    username: this.username,
                    password: this.password
                }
            }).then(
                res => {
                    console.log(res)
                },
            );
        }
    }

});
